/*
 * Apache Felix OSGi tutorial.
**/

package upnp.toy;


import java.util.Dictionary;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.upnp.UPnPDevice;



public class Activator implements BundleActivator, ServiceListener
{
	
	private ServiceRegistration serviceRegistration;
	private BundleContext context;
	private Toy toy;	

	
	public void start(BundleContext context) throws Exception {
		
		this.context=context;
		toy=new Toy(context);
		Dictionary dict=toy.getToyDevice().getDescriptions(null);
		serviceRegistration=context.registerService(UPnPDevice.class.getName(), toy.getToyDevice(),
				dict);
		
		
	}

	
	public void stop(BundleContext arg0) throws Exception {
		serviceRegistration.unregister();
	}

	
	public void serviceChanged(ServiceEvent arg0) {
		// TODO Auto-generated method stub
		
	}
   
}